
using System;
using NUnit.Framework;

using stefc.geo.lib;

namespace stefc.geo.test
{

	[TestFixture]
	public class Test
	{
	
		private Geographic berlin;
		private Geographic lissabon;
		private Geographic tokio;
		private Geographic moskau;
	
		[SetUp]
		public void SetUp()
		{
			berlin = new Geographic(52.5164, 13.3777);
			lissabon = new Geographic(38.692668, -9.177944);
			tokio = new Geographic(35.70, 139.767);
			moskau = new Geographic(55.75,37.616667);
		}
		
		[Test]
		public void GetDistance()
		{
			Assert.AreEqual(2317.72236d, berlin.GetDistance(lissabon), 0.0001d); 
			Assert.AreEqual(8930d, berlin.GetDistance(tokio), 1d);
		}
		
		[Test]
		public void GetAngle()
		{
			Assert.AreEqual(41d, berlin.GetAngle(tokio),1d, "berlin->tokio");
			Assert.AreEqual(330d, tokio.GetAngle(berlin),1d, "tokio->berlin");

			Assert.AreEqual(67d, berlin.GetAngle(moskau),1d, "berlin->moskau");
			Assert.AreEqual(267d, moskau.GetAngle(berlin),1d, "moskau->berlin");
			
			// 180
			
			//Assert.AreEqual(29.6d, lissabon.GetAngle(tokio), 0.1d, "lissabon->tokio");
			//Assert.AreEqual(18.3d, tokio.GetAngle(lissabon),0.1d, "tokio->lissabon");
			// 47.9
		}
		
		[Test]
		public void GeoToString()
		{
			Assert.AreEqual("55°45′0″N 37°37′40″E", moskau.ToString());
		}
		
	}
}
